home *** CD-ROM | disk | FTP | other *** search
/ NCSoft Asset Disc (USA) / NCSoft Asset Disc (USA).bin / base.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2003-05-03  |  6.3 KB  |  253 lines

  1. function searchContents(name)
  2. {
  3.    z = 0;
  4.    while(z < _level0.contents.length)
  5.    {
  6.       if(String(_level0.contents[z].indexKey) == name)
  7.       {
  8.          trace(z);
  9.          return z;
  10.       }
  11.       z++;
  12.    }
  13. }
  14. function xmlDataInput(nodeNum)
  15. {
  16.    defaultnode = xmlData.childNodes[0].childNodes[nodeNum];
  17.    num = defaultnode.childNodes.length;
  18.    if(num == undefined)
  19.    {
  20.       trace("undefined XML data error");
  21.    }
  22.    else
  23.    {
  24.       k = 0;
  25.       while(k < num)
  26.       {
  27.          file = defaultnode.childNodes[k].childNodes[0].nodeValue;
  28.          level = defaultnode.nodeName;
  29.          title = defaultnode.childNodes[k].attributes.title;
  30.          indexKey = defaultnode.childNodes[k].nodeName;
  31.          contents.push({indexKey:indexKey,file:file,level:level,title:title});
  32.          k++;
  33.       }
  34.    }
  35. }
  36. function createContents(success)
  37. {
  38.    if(success)
  39.    {
  40.       level_count = xmlData.childNodes[0].childNodes.length;
  41.       i = 0;
  42.       while(i < level_count)
  43.       {
  44.          xmlDataInput(i);
  45.          i++;
  46.       }
  47.       _level0.korPath = xmlData.childNodes[1].childNodes[0].nodeValue;
  48.       _level0.engPath = xmlData.childNodes[2].childNodes[0].nodeValue;
  49.       _level0.japPath = xmlData.childNodes[3].childNodes[0].nodeValue;
  50.       _level0.simPath = xmlData.childNodes[4].childNodes[0].nodeValue;
  51.       _level0.tradPath = xmlData.childNodes[5].childNodes[0].nodeValue;
  52.       _level0.movPath = xmlData.childNodes[6].childNodes[0].nodeValue;
  53.       _level0.downPath = xmlData.childNodes[7].childNodes[0].nodeValue;
  54.    }
  55. }
  56. function loadContents(success)
  57. {
  58.    createContents(success);
  59.    loadCommandEX("language");
  60. }
  61. fscommand("fullscreen","true");
  62. fscommand("allowscale","false");
  63. fscommand("showmenu","false");
  64. var startMovie;
  65. var globalDepth = 1;
  66. var currentPath;
  67. MovieClip.prototype.dumpStop = function(targetFrame)
  68. {
  69.    this.onEnterFrame = function()
  70.    {
  71.       if(this._currentframe != targetFrame)
  72.       {
  73.          this.gotoAndStop(targetFrame);
  74.       }
  75.       else
  76.       {
  77.          this.onEnterFrame = null;
  78.       }
  79.    };
  80. };
  81. MovieClip.prototype.targetPlay = function(targetFrame)
  82. {
  83.    this.onEnterFrame = function()
  84.    {
  85.       if(this._currentframe > targetFrame)
  86.       {
  87.          this.prevFrame();
  88.       }
  89.       else if(this._currentframe < targetFrame)
  90.       {
  91.          this.nextFrame();
  92.       }
  93.       else
  94.       {
  95.          this.gotoAndStop(targetFrame);
  96.          this.onEnterFrame = null;
  97.       }
  98.    };
  99. };
  100. MovieClip.prototype.move = function(tPos, speed)
  101. {
  102.    this.createEmptyMovieClip(this._name + "1",10);
  103.    this[this._name + "1"].onEnterFrame = function()
  104.    {
  105.       if(this._parent._y > tPos)
  106.       {
  107.          var distance = this._parent._y - tPos;
  108.          this._parent._y -= Math.ceil(distance * speed);
  109.       }
  110.       else if(this._parent._y < tPos)
  111.       {
  112.          var distance = tPos - this._parent._y;
  113.          this._parent._y += Math.ceil(distance * speed);
  114.       }
  115.       else
  116.       {
  117.          this.onEnterFrame = null;
  118.       }
  119.    };
  120. };
  121. MovieClip.prototype.BSloader = function(filename, level)
  122. {
  123.    if(level != "mov")
  124.    {
  125.       loadMovieNum(filename,Number(level));
  126.    }
  127.    else
  128.    {
  129.       loadMovie(filename,eval(level));
  130.    }
  131.    _level0.loadswf.push(filename);
  132.    _level0.loadlevel.push(level);
  133.    _level0.totalcheck = [];
  134.    _level0.fl = 0;
  135.    _level0.ft = 0;
  136.    _level0.onEnterFrame = function()
  137.    {
  138.       z = 0;
  139.       if(!_level0.check_load)
  140.       {
  141.          i = 0;
  142.          while(i < _level0.loadswf.length)
  143.          {
  144.             targetLevel = eval("_level" + String(_level0.loadlevel[i]));
  145.             total = targetLevel.getBytesTotal();
  146.             if(total > 0)
  147.             {
  148.                _level0.totalcheck[i] = total;
  149.                z++;
  150.                check_count++;
  151.                if(check_count > 100)
  152.                {
  153.                   _level0.onEnterFrame = null;
  154.                }
  155.             }
  156.             i++;
  157.          }
  158.          if(z == _level0.loadswf.length)
  159.          {
  160.             i = 0;
  161.             while(i < _level0.loadswf.length)
  162.             {
  163.                ft += _level0.totalcheck[i];
  164.                i++;
  165.             }
  166.             _level0.check_load = true;
  167.          }
  168.       }
  169.       else
  170.       {
  171.          i = 0;
  172.          while(i < _level0.loadswf.length)
  173.          {
  174.             targetLevel = eval("_level" + String(_level0.loadlevel[i]));
  175.             fl += targetLevel.getBytesLoaded();
  176.             i++;
  177.          }
  178.          p = Math.round(fl / ft * 100);
  179.          if(fl == ft)
  180.          {
  181.             i = 0;
  182.             while(i < _level0.loadswf.length)
  183.             {
  184.                targetLevel = eval("_level" + String(_level0.loadlevel[i]));
  185.                targetLevel.gotoAndPlay(targetLevel._currentframe + 1);
  186.                i++;
  187.             }
  188.             _level0.loadswf = [];
  189.             _level0.loadlevel = [];
  190.             _level0.onEnterFrame = null;
  191.             _level0.check_load = false;
  192.             _level0.totalcheck = [];
  193.             ft = 0;
  194.          }
  195.          else
  196.          {
  197.             fl = 0;
  198.          }
  199.       }
  200.    };
  201. };
  202. MovieClip.prototype.loadCommandEX = function(name)
  203. {
  204.    swfID = _level0.searchContents(name);
  205.    i = 0;
  206.    while(i < _level0.contents.length)
  207.    {
  208.       if(i == swfID)
  209.       {
  210.          BSloader(_level0.contents[i].file,_level0.contents[i].level);
  211.       }
  212.       i++;
  213.    }
  214. };
  215. MovieClip.prototype.loadMov = function(name, targetMovie)
  216. {
  217.    swfID = _level0.searchContents(name);
  218.    i = 0;
  219.    while(i < _level0.contents.length)
  220.    {
  221.       if(i == swfID)
  222.       {
  223.          BSloader(_level0.contents[i].file,targetMovie);
  224.       }
  225.       i++;
  226.    }
  227. };
  228. MovieClip.prototype.contentsLevel = function(name)
  229. {
  230.    num = _level0.searchContents(name);
  231.    targetlevel = eval("_level" + _root.contents[num].level);
  232.    return targetlevel;
  233. };
  234. MovieClip.prototype.download = function(filename)
  235. {
  236.    getURL(_level0.downPath + filename,"_blank");
  237. };
  238. MovieClip.prototype.openfolder = function(name)
  239. {
  240.    drive = this._url;
  241.    trace(drive);
  242.    drive = drive.substr(8,1);
  243.    getURL(drive + ":" + name,"");
  244. };
  245. Stage.showMenu = false;
  246. contents = new Array();
  247. loadswf = new Array();
  248. loadlevel = new Array();
  249. xmlData = new XML();
  250. xmlData.ignoreWhite = true;
  251. xmlData.onLoad = loadContents;
  252. xmlData.load("contents.xml");
  253.